<template>
  <div class="EmergencyList">
    <div class="flex location-wrap">
      <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EDManagement' }">应急处置</el-breadcrumb-item>
        <el-breadcrumb-item>调整及终止</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="box">
      <!-- 列表筛选 -->
      <filterTitle @query="query" @reset="reset" :form="form" labelWidth="140px" :formData="formData"
        @node-click="deptChoose">
        <!-- <el-form slot="filter" class="form" ref="form" :model="form" inline size="small" label-width="140px">
          <el-form-item :label="item.label + '：'" v-for="(item, index) in formData" :key="index" :rules="rules[item.id]" :prop="item.id">
            <LsdForm :compData="item" @change="change" @node-click="deptChoose(arguments, item)" :form="form" />
          </el-form-item>
        </el-form> -->
      </filterTitle>
      <!-- 列表表格 -->
      <LsdTable slot="yjxdlb" :paginationAtrrs="config.table.paginationAtrrs" :compRef="config.table.compRef" ref="yjxdlb"
        :columns="config.table.columns" :title="config.table.title" :actions="config.table.actions"
        :tableData="config.table.tableData" :tableAttr="config.table.tableAttr" :isShowPage="config.table.isShowPage"
        :isSelectFlag="config.table.isSelectFlag" :isSequenceFlag="config.table.isSequenceFlag"
        @pageChange="handleSizeChange" @onActionClick="onActionClick" />
    </div>
    <!-- 新增弹窗信息 -->
    <LsdDialog @handleBtn="onActionClick" :dialogConfig="dialogConfig" @close="close(dialogConfig)">
      <LsdDialogTitle slot="dialog" :titleConfig="titleConfig" :activeNames="activeNames">
        <DialogForm @handleNodeClick="handleNodeClick" ref="formComponent" slot="slot1" @pickerChange="pickerChange"
          :formConfig="formConfig" />
        <LsdTable slot="slot2" :formLabel="config.table1.formLabel" :autoHeight="config.table1.autoHeight"
          :compRef="config.table1.compRef" ref="xzdw"
          :columns="['sp', 'jc'].includes(dialogConfig.type) ? config.table1.columns1 : config.table1.columns"
          :title="config.table1.title" :actions="config.table1.actions" :tableData="config.table1.tableData"
          :tableAttr="config.table1.tableAttr" :isShowPage="config.table1.isShowPage"
          :isSelectFlag="config.table1.isSelectFlag" :isSequenceFlag="config.table1.isSequenceFlag"
          @onActionClick="onActionClick" />
        <DialogForm ref="formComponent1" slot="slot3" :formConfig="formConfig1" />
        <DialogForm ref="formComponent2" slot="slot4" :formConfig="formConfig2" />
        <DialogForm ref="formComponent3" slot="slot5" :formConfig="formConfig3" />
      </LsdDialogTitle>
    </LsdDialog>
    <!-- 预览 -->
    <LsdDialog :dialogConfig="dialogConfig1" @close="closes" @handleBtnX="handleBtnX" @handleBtnD="tzdPrint">
      <Preview slot="dialog" :id="id" :previewVisible.sync="dialogConfig1.isShow" />
    </LsdDialog>
  </div>
</template>

<script>
// xymldFeedbackapprove,
import { xymldSubmissionList, getinfo, adjustSave, xymldFeedbacksubmit, terminateEnd, editlist, deletelist } from "@/api/EmergencyDisposal/tzyzz";
import { sameLeveltree, getSubclassUntilList, getOrgDepartmentList, getSubclassUntilLists } from "@/api/EarlyWarningManagement/yjtzd";
import { getDictByGroup, listAccountByOrganization } from "@/api/common.js";
import { doDownPdf } from "@/api/EmergencyDisposal/xymld";
// import { getUnitTreeApi } from "@/api/EarlyWarningManagement/yjrb";
import Printer from "@/utils/operationTicketPrint";
// import { getPersonApi } from "@/api/EarlyWarningManagement/yjtzd";
import { getCityTree } from "@/api/EarlyWarningManagement/yjxxsj";
import Preview from "./components/Preview.vue";
import { showTime } from "@/lib";
import { flowSubmit } from "@/utils/flow";
export default {
  components: { Preview },
  data() {
    return {
      id: "",
      zrbmOption: [],
      config: {},
      form: {},
      resStatus: "",
      rules: {
        useUserName: [
          { required: true, message: "请输入领用人", trigger: "blur" }
        ]
      },
      // 弹窗信息
      dialogConfig: {
        title: "",
        isShow: false,
        type: "add",
        btnList: []
      },
      // 预览信息
      dialogConfig1: {
        title: "响应命令单",
        isShow: false, // 弹窗显示隐藏
        btnLists: []
      },
      DetailList: {},
      // 折叠面板
      titleConfig: [],
      activeNames: ["1", "2", "3", "4", "5"],
      // 筛选条件
      formData: [
        {
          elType: "input",
          id: "responseName",
          label: "响应命令单",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true
          }
        },
        {
          elType: "select",
          id: "eventCode",
          label: "事件类别",
          dic: "dic_sjlb",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "select",
          id: "responseLvCode",
          label: "响应级别",
          dic: "dic_xyjb",
          attrs: {
            value: "",
            clearable: true,
            size: "small",
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "input",
          id: "effectRange",
          label: "影响范围",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          }
        },
        {
          elType: "selectTree",
          id: "infoSource",
          name: "unitId",
          label: "发布单位",
          attrs: {
            value: "",
            clearable: true,
            "collapse-tags": true
          },
          options: {
            attrs: {
              value: ""
            }
          },
          treeData: {
            attrs: {
              data: []
            },
            props: {
              children: "children",
              label: "orgName",
              value: "id"
            }
          }
        },

        {
          elType: "dateTimePicker",
          id: "approvalTime",
          label: "发布时间",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            type: "datetimerange",
            "start-placeholder": "开始日期",
            "end-placeholder": "结束日期",
            "value-format": "yyyy-MM-dd HH:mm:ss"
          }
        },
        {
          elType: "dateTimePicker",
          id: "terminateTime",
          label: "终止时间",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            type: "datetimerange",
            "start-placeholder": "开始日期",
            "end-placeholder": "结束日期",
            "value-format": "yyyy-MM-dd HH:mm:ss"
          }
        },
        // {
        //   elType: "dateTimePicker",
        //   id: "approvalTime",
        //   label: "发布时间",
        //   attrs: {
        //     value: "",
        //     size: "small",
        //     clearable: true,
        //     type: "datetime",
        //     "value-format": "yyyy-MM-dd HH:mm:ss"
        //   }
        // },
        // {
        //   elType: "dateTimePicker",
        //   id: "terminateTime",
        //   label: "终止时间",
        //   attrs: {
        //     value: "",
        //     size: "small",
        //     clearable: true,
        //     type: "datetime",
        //     "value-format": "yyyy-MM-dd HH:mm:ss"
        //   }
        // },
        {
          elType: "select",
          id: "responseState",
          label: "状态",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: [
            { label: "待审批", value: "1" },
            { label: "已发布", value: "2" },
            { label: "驳回", value: "3" },
            { label: "终止", value: "4" }
          ]
        }
      ],
      formConfig: {
        formData: [],
        rules: {}
      },
      formConfig1: {
        formData: [],
        rules: {}
      },
      formConfig2: {
        formData: [
          {
            type: "input",
            label: "填报人",
            prop: "creator",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "input",
            label: "单位及部门",
            prop: "createDeptName",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "dataPicker",
            label: "填报时间",
            prop: "createTime",
            class: "third",
            lableWidth: "140px",
            dateType: "datetime",
            isDisabled: true
          }
        ]
      },
      formConfig3: {
        formData: [
          {
            type: "input",
            label: "审批意见",
            prop: "approvalOpinion",
            class: "sjgy",
            lableWidth: "140px",
            isDisabled: false
          },
          {
            type: "input",
            label: "审批人",
            prop: "approvalUser",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "input",
            label: "单位及部门",
            prop: "approvalDept",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "dataPicker",
            label: "审批时间",
            prop: "approvalTime",
            class: "third",
            lableWidth: "140px",
            dateType: "datetime",
            isDisabled: true
          }
        ]
      },
      judgeId: "",
      infoId: "",
      infoIds: "",
      fid: "",
      orgId: ""
    };
  },
  watch: {
    "$route.query.responseState": {
      handler() {
        this.getList();
      },
      deep: true
    }
  },
  created() {
    this.getUnitTree();
    this.config = require(`./config`).default.config(this);
    this.getInputVal();
    this.getList();
    if (this.$route.query.id) {
      if (this.$route.query.type === 1) {
        this.actionHandle("调整");
      } else if (this.$route.query.type === 2) {
        this.actionHandle("解除");
      }
    }
  },
  methods: {
    // 打印
    tzdPrint() {
      getinfo({ id: this.id }).then(res => {
        const readerFun = () => {
          const html = Printer.xymldPrinter(res);
          return html;
        };
        window.open("").document.write(Printer.printerOperationTicket(readerFun));

      });
    },
    // 下载
    handleBtnX() {
      doDownPdf({ id: this.id }).then(res => {
        const response = res; // 后端返回的数据流
        const filename = "响应命令单.pdf"; // 下载的文件名
        // 创建一个 Blob URL，指向数据流
        const blobUrl = URL.createObjectURL(response);
        // 创建一个链接元素
        const link = document.createElement("a");
        link.href = blobUrl;
        link.target = "_blank";
        link.download = filename;
        // 触发下载
        link.click();
        // 释放 Blob URL
        URL.revokeObjectURL(blobUrl);
      });

    },
    closes() {
      this.dialogConfig1.isShow = false;
    },
    // 工作流提交
    gzlSubmit(bizKey, variable) {
      const data = {
        bizKey,
        flowKey: "emergency_response_001",
        taskId: "task1",
        callbackUrl: "/emergency/emergencyResponse/handleFlow",
        idea: "1",
        variable
      };
      const successCallBack = () => {
        this.$message({
          message: "提交成功",
          type: "success"
        });
        this.getList();
        this.dialogConfig.isShow = false;
      };
      flowSubmit(data, successCallBack, "提交", true);
    },
    // 工作流审批
    gzlAudit(type, variable) {
      let callbackUrl = "";
      let flowKey = "";
      if (type === 3) {
        callbackUrl = "/emergency/emergencyResponse/handleFlow";
        flowKey = "emergency_response_001";
      } else {
        callbackUrl = "/emergency/emergencyResponse/handleFlow";
        flowKey = "emergency_response_001";
      }
      const data = {
        bizKey: this.fid,
        flowKey: flowKey,
        taskId: "task2",
        callbackUrl: callbackUrl,
        idea: type === 3 ? "1" : "0",
        variable,
        ideaMsg: this.$refs.formComponent3.form.approvalOpinion ? this.$refs.formComponent3.form.approvalOpinion : type === 3 ? "同意" : "驳回"
      };
      const successCallBack = () => {
        this.$message({
          message: `${type === 3 ? "审核" : "驳回"}成功`,
          type: "success"
        });
        this.getList();
        this.dialogConfig.isShow = false;
      };
      flowSubmit(data, successCallBack, "审核");
    },
    // 影响范围树
    getUnitTree() {
      this.formConfig.formData.forEach((item) => {
        // 树状  派发单位/部门
        if (item.label === "影响范围") {
          getCityTree().then(res => {

            // this.formConfig.formData[4].treeData.data = res;
            item.treeData.data = res;
          });
        }
      });
      // getCityTree().then(res => {

      //   this.formConfig.formData[4].treeData.data = res;
      // });
      getSubclassUntilLists({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
        this.formData[4].treeData.attrs.data = res;
      });

    },
    // 影响范围
    handleNodeClick(data, node, item) {
      if (item.label === "影响范围") {
        const result = this.$refs.formComponent.form.effectRange;
        const datas = data.children || [];
        if (datas.length > 0) {
          if (result.includes(data.extName)) return;
          else {
            this.$refs.formComponent.form.effectRange.push(data.extName);
            this.$refs.formComponent.form.geo.push(data.geo);
          }
        } else {
          if (result.includes(`${node.parent.data.extName}${data.extName}`) || result.includes(`${data.extName}`)) return;
          else {
            if (node.parent.data.extName) {
              this.$refs.formComponent.form.effectRange.push(`${node.parent.data.extName}${data.extName}`);
            } else {
              this.$refs.formComponent.form.effectRange.push(`${data.extName}`);
            }
            this.$refs.formComponent.form.geo.push(data.geo);
          }
        }
      }
    },
    // 树状选择
    deptChoose(val, item) {
      this.$set(this.form, "infoSource", val[0].orgName);
      this.orgId = val[0].id;
    },
    async getOrgTree() {
      // const res = await getUnitTreeApi();
      // this.formConfig1.formData[0].option = res;
      // this.formConfig1.formData[1].option = res;
      this.formConfig1.formData.forEach((item) => {
        // 树状  派发单位/部门
        if (item.label === "主送单位") {
          getSubclassUntilList({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            item.treeData.data = res;
          });
        }
      });
      this.formConfig1.formData.forEach((item) => {
        // 树状  派发单位/部门
        if (item.label === "响应部门") {
          getOrgDepartmentList({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            item.treeData.data = res;
          });
        }
      });
    },
    // 列表接口
    getList(data) {
      let sta = "";
      if (this.$route.query.responseState) {
        sta = this.$route.query.responseState;
      } else {
        sta = this.form.responseState;
      }
      let type = "";
      if (this.$route.query.responseState === "1") {
        type = "0";
      }
      let parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        responseState: sta,
        roleCode: JSON.parse(sessionStorage.getItem("role")).roleCode,
        flowKey: "emergency_response_001",
        type: type

      };
      if (data) {
        parmas = data;
      }
      xymldSubmissionList(parmas).then((res) => {
        this.$set(this.config.table, "tableData", res.data);
        this.$set(this.config.table.paginationAtrrs, "total", res.total);
      });
    },
    // 详情接口
    getDetail(val) {
      getinfo({ id: val }).then(res => {
        this.infoId = res.infoId;
        this.infoIds = res.emergencyEventIds;
        this.judgeId = res.judgeId;
        this.fid = res.id;
        this.resStatus = res.responseState;
        this.$set(this.config.table1, "tableData", res.emergencyMeasureListVos);
        this.$set(this.$refs.formComponent.form, "emergencyId", res.emergencyId);
        this.$set(this.$refs.formComponent.form, "responseName", res.responseName);
        this.$set(this.$refs.formComponent.form, "judgeName", res.judgeName);
        this.$set(this.$refs.formComponent.form, "effectRange", res.effectRange.split("、"));
        this.$set(this.$refs.formComponent.form, "eventName", res.eventName);
        this.$set(this.$refs.formComponent.form, "eventCode", res.eventCode);
        this.$set(this.$refs.formComponent.form, "responseLvName", res.responseLvName);
        this.$set(this.$refs.formComponent.form, "responseLvCode", res.responseLvCode);
        // this.$set(this.$refs.formComponent.form, "effectRange", res.effectRange);
        this.$set(this.$refs.formComponent.form, "effectTime", res.effectTime);
        this.$set(this.$refs.formComponent.form, "incidentOutline", res.incidentOutline);
        this.$set(this.$refs.formComponent.form, "eventOutline", res.eventOutline);

        this.$set(this.$refs.formComponent1.form, "outTheNewspaper", res.outTheNewspaper);//  抄报部门名称
        this.$set(this.$refs.formComponent1.form, "newspaperId", res.outTheNewspaper);
        this.$set(this.$refs.formComponent1.form, "sendDuplicate", res.sendDuplicate);//  抄送部门名称
        this.$set(this.$refs.formComponent1.form, "sendDuplicateId", res.sendDuplicate);
        this.$set(this.$refs.formComponent2.form, "creator", res.creator);
        this.$set(this.$refs.formComponent2.form, "createDeptName", res.createDeptName);
        this.$set(this.$refs.formComponent2.form, "createTime", res.createTime);
        if (this.dialogConfig.type === "tz") {
          this.$set(this.$refs.formComponent1.form, "mainUnitName", res.mainUnitName.split("、") || []);// 主送单位
          this.$set(this.$refs.formComponent1.form, "mainUnitId", res.mainUnitId.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "responseDeptName", res.responseDeptName.split("、") || []); // 响应部门名称
          this.$set(this.$refs.formComponent1.form, "responseDeptId", res.responseDeptId.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "linkman", res.linkman.split(","));// 联系人
          this.$set(this.$refs.formComponent1.form, "linkmanId", res.linkmanId.split(","));
          this.$set(this.$refs.formComponent.form, "adjustExplain", "");
        } else if (this.dialogConfig.type === "bj") {
          this.$set(this.$refs.formComponent1.form, "mainUnitName", res.mainUnitName.split("、") || []);// 主送单位
          this.$set(this.$refs.formComponent1.form, "mainUnitId", res.mainUnitId.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "responseDeptName", res.responseDeptName.split("、") || []); // 响应部门名称
          this.$set(this.$refs.formComponent1.form, "responseDeptId", res.responseDeptId.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "linkman", res.linkman.split(","));// 联系人
          this.$set(this.$refs.formComponent1.form, "linkmanId", res.linkmanId.split(","));
          this.$set(this.$refs.formComponent.form, "adjustExplain", res.adjustExplain);
        } else if (this.dialogConfig.type === "sp") {
          console.log(res.mainUnitName, " res.mainUnitName res.mainUnitName");
          this.$set(this.$refs.formComponent.form, "emergencyId", res.emergencyId);
          this.$set(this.$refs.formComponent.form, "adjustExplain", res.adjustExplain);
          this.$set(this.$refs.formComponent.form, "effectRange", res.effectRange);
          this.$set(this.$refs.formComponent1.form, "mainUnitName", res.mainUnitName);
          this.$set(this.$refs.formComponent1.form, "mainUnitId", res.mainUnitId);
          this.$set(this.$refs.formComponent1.form, "responseDeptName", res.responseDeptName);
          this.$set(this.$refs.formComponent1.form, "responseDeptId", res.responseDeptId);
          this.$set(this.$refs.formComponent1.form, "linkman", res.linkman);
          this.$set(this.$refs.formComponent1.form, "linkmanId", res.linkmanId);
          this.$set(this.$refs.formComponent3.form, "approvalOpinion", "");
          this.$set(this.$refs.formComponent3.form, "approvalUser", res.approvalUser || JSON.parse(sessionStorage.getItem("account")).realName);
          this.$set(this.$refs.formComponent3.form, "approvalDept", res.approvalDept || JSON.parse(sessionStorage.getItem("org")).orgName);
          this.$set(this.$refs.formComponent3.form, "approvalTime", res.approvalTime || showTime(new Date()));
        } else if (this.dialogConfig.type === "jc") {
          this.$set(this.$refs.formComponent.form, "adjustExplain", res.adjustExplain);
          this.$set(this.$refs.formComponent.form, "effectRange", res.effectRange);
        }
      });
    },
    // 调用按钮对应方法
    onActionClick(item, index) {
      this[item.id]();
    },
    // 列表跳预警通知单
    detailList(row) {
      this.$router.push({
        name: "EmergencyResponseinfo",
        query: { id: row.id }
      });
    },
    // 列表页时间选择事件
    change(val) {
      this.form.effectStartTime = val[0];
      this.form.effectEndTime = val[1];
    },
    // 弹窗关闭
    close(val) {
      val.isShow = false;
      if (this.$route.query.type === 1) {
        this.$router.push({ path: "/EmergencyResponselist" });
      }
    },
    // 提交
    submit() {
      this.save("submit");
    },
    // 同意
    agree() {
      this.save("agree");
    },
    // 驳回
    rejected() {
      this.save("rejected");
    },
    // 保存/调整/提交
    save(val) {
      this.$refs.formComponent.isValidate();
      this.$refs.formComponent1.isValidate();
      const flag = this.$refs.formComponent.flag;
      const flag1 = this.$refs.formComponent1.flag;
      // const flatMainUnit = this.flatTreeArr(this.formConfig1.formData[0].option);
      // const flatResponseDept = this.flatTreeArr(this.formConfig1.formData[0].option);
      // const mainUnitName = flatMainUnit.filter(item => this.$refs.formComponent1.form.mainUnitId.includes(item.id)).map(item => item.orgName);
      // const responseDeptName = flatResponseDept.filter(item => this.$refs.formComponent1.form.responseDeptId.includes(item.id)).map(item => item.orgName);
      if (flag && flag1) {
        const parmas = {
          judgeId: this.judgeId,
          infoId: this.infoId,
          emergencyEventIds: this.infoIds,
          emergencyId: this.$refs.formComponent.form.emergencyId,
          responseName: this.$refs.formComponent.form.responseName,
          eventName: this.$refs.formComponent.form.eventName,
          incidentOutline: this.$refs.formComponent.form.incidentOutline,
          eventCode: this.$refs.formComponent.form.eventCode,
          responseLvName: this.$refs.formComponent.form.responseLvName,
          responseLvCode: this.$refs.formComponent.form.responseLvCode,
          effectRange: this.$refs.formComponent.form.effectRange instanceof Array ? this.$refs.formComponent.form.effectRange.join("、") : this.$refs.formComponent.form.effectRange,
          effectTime: this.$refs.formComponent.form.effectTime,
          adjustExplain: this.$refs.formComponent.form.adjustExplain,
          eventOutline: this.$refs.formComponent.form.eventOutline,

          responseDeptName: this.$refs.formComponent1.form.responseDeptName instanceof Array ? this.$refs.formComponent1.form.responseDeptName.join("、") : this.$refs.formComponent1.form.responseDeptName,
          responseDeptId: this.$refs.formComponent1.form.responseDeptId instanceof Array ? this.$refs.formComponent1.form.responseDeptId.join("、") : this.$refs.formComponent1.form.responseDeptId,
          mainUnitName: this.$refs.formComponent1.form.mainUnitName instanceof Array ? this.$refs.formComponent1.form.mainUnitName.join("、") : this.$refs.formComponent1.form.mainUnitName,
          mainUnitId: this.$refs.formComponent1.form.mainUnitId instanceof Array ? this.$refs.formComponent1.form.mainUnitId.join("、") : this.$refs.formComponent1.form.mainUnitId,
          linkman: this.$refs.formComponent1.form.linkman instanceof Array ? this.$refs.formComponent1.form.linkman.join() : this.$refs.formComponent1.form.linkman,
          linkmanId: this.$refs.formComponent1.form.linkmanId instanceof Array ? this.$refs.formComponent1.form.linkmanId.join() : this.$refs.formComponent1.form.linkmanId,



          // mainUnitName: mainUnitName instanceof Array ? mainUnitName.join() : mainUnitName,
          // mainUnitId: this.$refs.formComponent1.form.mainUnitId.join(), // 主送单位id
          // responseDeptName: responseDeptName instanceof Array ? responseDeptName.join() : responseDeptName, // 响应部门名称
          // responseDeptId: this.$refs.formComponent1.form.responseDeptId.join(), // 响应部门id
          // linkman: this.$refs.formComponent1.form.linkman instanceof Array ? this.$refs.formComponent1.form.linkman.join() : this.$refs.formComponent1.form.linkman,
          // linkmanId: this.$refs.formComponent1.form.linkmanId.join(), // 联系人id
          outTheNewspaper: this.$refs.formComponent1.form.outTheNewspaper instanceof Array ? this.$refs.formComponent1.form.outTheNewspaper.join() : this.$refs.formComponent1.form.outTheNewspaper,
          // newspaperId: this.$refs.formComponent1.form.newspaperId.join(),
          sendDuplicate: this.$refs.formComponent1.form.sendDuplicate instanceof Array ? this.$refs.formComponent1.form.sendDuplicate.join() : this.$refs.formComponent1.form.sendDuplicate,
          // sendDuplicateId: this.$refs.formComponent1.form.sendDuplicateId.join(),
          creator: this.$refs.formComponent2.form.creator,
          createDeptName: this.$refs.formComponent2.form.createDeptName,
          createTime: this.$refs.formComponent2.form.createTime,
          emergencyMeasureUpdDtos: this.config.table1.tableData, // 有关措施与要求
          id: this.fid,
          responseState: this.resStatus
        };
        // 提交
        if (val === "submit") {
          xymldFeedbacksubmit(parmas).then((res) => {
            if (res) {
              // this.$message({
              //   message: "提交成功",
              //   type: "success"
              // });
              // this.getList();
              // this.dialogConfig.isShow = false;
              this.gzlSubmit(res, parmas);
            }
          });
        } else if (val === "agree") {
          parmas.approveSign = "pass";
          parmas.approvalOpinion = this.$refs.formComponent3.form.approvalOpinion;
          parmas.approvalUser = this.$refs.formComponent3.form.approvalUser;
          parmas.approvalDept = this.$refs.formComponent3.form.approvalDept;
          parmas.approvalTime = this.$refs.formComponent3.form.approvalTime;
          // xymldFeedbackapprove(parmas).then((res) => {
          //   if (res) {
          //     this.$message({
          //       message: "审核成功",
          //       type: "success"
          //     });
          //     this.getList();
          //     this.dialogConfig.isShow = false;
          //   }
          // });
          this.gzlAudit(3, parmas);
        } else if (val === "rejected") {
          parmas.approveSign = "reject";
          parmas.approvalOpinion = this.$refs.formComponent3.form.approvalOpinion;
          parmas.approvalUser = this.$refs.formComponent3.form.approvalUser;
          parmas.approvalDept = this.$refs.formComponent3.form.approvalDept;
          parmas.approvalTime = this.$refs.formComponent3.form.approvalTime;
          parmas.approvalTime = this.$refs.formComponent3.form.approvalTime;
          // xymldFeedbackapprove(parmas).then((res) => {
          //   if (res) {
          //     this.$message({
          //       message: "提交成功",
          //       type: "success"
          //     });
          //     this.getList();
          //     this.dialogConfig.isShow = false;
          //   }
          // });
          this.gzlAudit(4, parmas);
        } else {
          // 调整
          if (this.dialogConfig.type === "tz") {
            adjustSave(parmas).then((res) => {
              if (res) {
                this.$message({
                  message: "保存成功",
                  type: "success"
                });
                this.getList();
                this.dialogConfig.isShow = false;
              }
            });
          } else if (this.dialogConfig.type === "jc") {
            parmas.terminateTime = this.$refs.formComponent.form.terminateTime;
            parmas.terminateExplain = this.$refs.formComponent.form.terminateExplain;
            parmas.id = this.fid;
            terminateEnd(parmas).then(res => {
              if (res) {
                this.$message({
                  message: "终止成功",
                  type: "success"
                });
                this.getList();
                this.dialogConfig.isShow = false;
              }
            });
          } else {
            // 修改
            editlist(parmas).then((res) => {
              if (res) {
                this.$message({
                  message: "保存成功",
                  type: "success"
                });
                this.getList();
                this.dialogConfig.isShow = false;
              }
            });
          }
        }
      }
    },
    // 取消
    cancel() {
      this.dialogConfig.isShow = false;
      if (this.$route.query.type === 1) {
        this.$router.push({ path: "/EmergencyResponselist" });
      }
    },
    // 列表删除
    delete(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        deletelist({
          id: row.row.id
        }).then(data => {
          if (data) {
            this.$message({
              message: "删除成功",
              type: "success"
            });
            this.getList();
          }
        });
      }).catch(() => {
        this.$message({
          type: "info",
          message: "已取消删除"
        });
      });
    },
    actionHandle(item, row) {
      if (["调整", "编辑", "审批"].includes(item)) {
        this.dialogConfig.isShow = true;
        if (item === "调整") {
          this.dialogConfig.type = "tz";
        } else if (item === "编辑") {
          this.dialogConfig.type = "bj";
        } else if (item === "审批") {
          this.dialogConfig.type = "sp";
        }
        this.dialogConfig.title = "响应命令单调整申请";
        if (["调整", "编辑"].includes(item)) {
          console.log("################");
          this.dialogConfig.btnList = [
            {
              name: "提交",
              type: "primary",
              id: "submit",
              size: "mini"
            },
            // {
            //   name: "保存",
            //   id: "save",
            //   size: "mini"
            // },
            {
              name: "取消",
              id: "cancel",
              size: "mini"
            }
          ];
          this.titleConfig = [
            {
              title: "基本信息",
              name: "1",
              slot: "slot1"
            },
            {
              title: "措施要求",
              name: "2",
              slot: "slot2"
            },
            {
              title: "响应信息",
              name: "3",
              slot: "slot3"
            },
            {
              title: "填报信息",
              name: "4",
              slot: "slot4"
            }
          ];
          this.formConfig.formData = [
            {
              type: "input",
              label: "响应命令单",
              prop: "responseName",
              isDisabled: true,
              class: "sjgy",
              lableWidth: "120px"
            },
            {
              type: "select",
              label: "响应研判单",
              prop: "judgeName",
              isDisabled: true,
              // multiple: true,
              name: "judgeName",
              class: "sjgy",
              lableWidth: "120px",
              option: []
            },
            {
              type: "select",
              label: "事件类别",
              dic: "dic_sjlb",
              name: "eventName",
              prop: "eventCode",
              class: "half",
              lableWidth: "120px",
              // isDisabled: true,
              option: []
            },
            {
              type: "select",
              label: "响应级别",
              dic: "dic_xyjb",
              prop: "responseLvCode",
              name: "responseLvName",
              class: "half",
              lableWidth: "120px",
              // isDisabled: true,
              option: []
            },
            {
              type: "selectTree",
              label: "影响范围",
              prop: "effectRange",
              name: "geo",
              keyWord: "keyWord3",
              treeRef: "treeRef3",
              clickClose: true,
              title: "影响范围选择",
              choose: false,
              ref: "tree_select3",
              class: "half",
              multiple: true,
              lableWidth: "120px",
              option: [],
              treeData: {
                data: [],
                checked: [],
                props: {
                  children: "children",
                  label: "extName",
                  value: "geo"
                }
              }
            },
            {
              // type: "dataPicker",
              type: "input",
              label: "影响时间",
              prop: "effectTime",
              isDisabled: true,
              class: "half",
              dateType: "effectTime",
              lableWidth: "120px"
            },
            {
              label: "调整说明",
              type: "input",
              prop: "adjustExplain",
              class: "half",
              lableWidth: "120px"
            },
            {
              label: "事件概要",
              type: "textarea",
              prop: "incidentOutline",
              // isDisabled: true,
              class: "sjgy",
              lableWidth: "120px"
            }
          ];
          this.formConfig1.formData = [
            // {
            //   type: "cascader",
            //   label: "主送单位",
            //   prop: "mainUnitId",
            //   // name: "unitName",
            //   // dic: "unit",
            //   isDisabled: false,
            //   class: "sjgy",
            //   multiple: true,
            //   lableWidth: "120px",
            //   option: [],
            //   props: {
            //     label: "orgName",
            //     value: "id",
            //     checkStrictly: true,
            //     emitPath: false,
            //     multiple: true,
            //     expandTrigger: "hover"
            //   }
            // },
            {
              type: "selectTree",
              label: "主送单位",
              prop: "mainUnitName",
              name: "mainUnitId",
              keyWord: "keyWord",
              treeRef: "treeRef",
              commonClick: true,
              clickClose: false,
              multiple: true,
              title: "主送单位选择",
              choose: false,
              ref: "tree_select",
              class: "sjgy",
              lableWidth: "120px",
              option: [],
              treeData: {
                data: [],
                default: ["1"],
                checked: [],
                props: {
                  children: "children",
                  label: "orgName",
                  value: "id"
                }
              }
            },
            {
              type: "selectTree",
              label: "响应部门",
              prop: "responseDeptName",
              name: "responseDeptId",
              keyWord: "keyWord1",
              treeRef: "treeRef1",
              commonClick: true,
              clickClose: false,
              multiple: true,
              title: "响应部门选择",
              choose: false,
              ref: "tree_select1",
              class: "sjgy",
              lableWidth: "120px",
              option: [],
              treeData: {
                data: [],
                default: ["1"],
                checked: [],
                props: {
                  children: "children",
                  label: "orgName",
                  value: "id"
                }
              }
            },
            // {
            //   type: "cascader",
            //   label: "响应部门",
            //   prop: "responseDeptId",
            //   // name: "unitName",
            //   // dic: "unit",
            //   isDisabled: false,
            //   class: "sjgy",
            //   multiple: true,
            //   lableWidth: "120px",
            //   option: [],
            //   props: {
            //     label: "orgName",
            //     value: "id",
            //     checkStrictly: true,
            //     emitPath: false,
            //     multiple: true,
            //     expandTrigger: "hover"
            //   }
            // },
            // {
            //   label: "主送单位",
            //   dic: "unit",
            //   type: "select",
            //   prop: "mainUnitId",
            //   name: "mainUnitName",
            //   class: "sjgy",
            //   lableWidth: "120px",
            //   multiple: true,
            //   option: []
            // },
            // {
            //   label: "响应部门",
            //   dic: "dept",
            //   type: "select",
            //   prop: "responseDeptId",
            //   name: "responseDeptName",
            //   class: "sjgy",
            //   lableWidth: "120px",
            //   multiple: true,
            //   option: []
            // },
            {
              label: "联系人",
              type: "select",
              prop: "linkman",
              name: "linkmanId",
              filterable: true,
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              option: []
            },
            {
              label: "抄报",
              dic: "dic_cb",
              type: "input",
              prop: "outTheNewspaper",
              name: "newspaperId",
              class: "half",
              lableWidth: "120px"
            },
            {
              label: "抄送",
              dic: "dic_cs",
              type: "input",
              prop: "sendDuplicate",
              name: "sendDuplicateId",
              class: "half",
              lableWidth: "120px"
            }
          ];
          this.formConfig.rules = {
            eventCode: [
              { required: true, message: "请选择事件类别", trigger: "blur" }
            ],
            responseLvCode: [
              { required: true, message: "请选择响应级别", trigger: "blur" }
            ],
            effectRange: [
              { required: true, message: "请选择影响范围", trigger: "blur" }
            ],
            // effectTime: [
            //   { required: true, message: "请选择影响时间", trigger: "blur" }
            // ],
            adjustExplain: [
              { required: true, message: "请输入调整说明", trigger: "blur" }
            ],
            incidentOutline: [
              { required: true, message: "请输入事件概要", trigger: "blur" }
            ]
          };
          this.formConfig1.rules = {
            mainUnitId: [
              { required: true, message: "请选择主送单位", trigger: "blur" }
            ],
            responseDeptId: [
              { required: true, message: "请选择响应部门", trigger: "blur" }
            ],
            linkmanId: [
              { required: true, message: "请选择联系人", trigger: "blur" }
            ],
            newspaperId: [
              { required: true, message: "请选择抄报", trigger: "blur" }
            ],
            sendDuplicateId: [
              { required: true, message: "请选择抄送", trigger: "blur" }
            ]
          };
          this.config.table1.formLabel.prompt = true;
        } else if (["审批"].includes(item)) {
          this.dialogConfig.type = "sp";
          this.dialogConfig.btnList = [
            {
              name: "同意",
              type: "primary",
              id: "agree",
              size: "mini"
            },
            {
              name: "驳回",
              id: "rejected",
              size: "mini"
            },
            {
              name: "取消",
              id: "cancel",
              size: "mini"
            }
          ];
          this.titleConfig = [
            {
              title: "基本信息",
              name: "1",
              slot: "slot1"
            },
            {
              title: "措施要求",
              name: "2",
              slot: "slot2"
            },
            {
              title: "响应信息",
              name: "3",
              slot: "slot3"
            },
            {
              title: "填报信息",
              name: "4",
              slot: "slot4"
            },
            {
              title: "审判信息",
              name: "5",
              slot: "slot5"
            }
          ];
          this.formConfig.formData = [
            {
              type: "input",
              label: "响应命令单",
              prop: "responseName",
              class: "sjgy",
              lableWidth: "120px",
              isDisabled: true
            },
            {
              type: "input",
              label: "响应研判单",
              prop: "judgeName",
              isDisabled: true,
              // multiple: true,
              name: "judgeName",
              class: "sjgy",
              lableWidth: "120px",
              option: []
            },
            {
              type: "select",
              label: "事件类别",
              dic: "dic_sjlb",
              name: "eventName",
              prop: "eventCode",
              class: "half",
              lableWidth: "120px",
              option: [],
              isDisabled: true
            },
            {
              type: "select",
              label: "响应级别",
              dic: "dic_xyjb",
              prop: "responseLvCode",
              name: "responseLvName",
              class: "half",
              lableWidth: "120px",
              option: [],
              isDisabled: true
            },
            {
              type: "input",
              label: "影响范围",
              prop: "effectRange",
              class: "half",
              lableWidth: "120px",
              isDisabled: true
            },
            {
              // type: "dataPicker",
              type: "input",
              label: "影响时间",
              prop: "effectTime",
              isDisabled: true,
              class: "half",
              dateType: "effectTime",
              lableWidth: "120px"
            },
            {
              label: "调整说明",
              type: "input",
              prop: "adjustExplain",
              class: "half",
              lableWidth: "120px",
              isDisabled: true
            },
            {
              label: "事件概要",
              type: "textarea",
              prop: "incidentOutline",
              class: "sjgy",
              lableWidth: "120px",
              isDisabled: true
            }
          ];
          this.formConfig1.formData = [
            {
              label: "主送单位",
              dic: "unit",
              type: "select",
              prop: "mainUnitId",
              name: "mainUnitName",
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              option: [],
              isDisabled: true
            },
            {
              label: "响应部门",
              dic: "dept",
              type: "select",
              prop: "responseDeptId",
              name: "responseDeptName",
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              option: [],
              isDisabled: true
            },
            {
              label: "联系人",
              type: "select",
              prop: "linkmanId",
              filterable: true,
              name: "linkman",
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              option: [],
              isDisabled: true
            },
            {
              label: "抄报",
              dic: "dic_cb",
              type: "select",
              prop: "outTheNewspaper",
              name: "newspaperId",
              class: "half",
              lableWidth: "120px",
              multiple: true,
              option: [],
              isDisabled: true
            },
            {
              label: "抄送",
              dic: "dic_cs",
              type: "select",
              prop: "sendDuplicate",
              name: "sendDuplicateId",
              class: "half",
              lableWidth: "120px",
              multiple: true,
              option: [],
              isDisabled: true
            }
          ];
          this.formConfig.rules = {};
          this.formConfig3.formData[0].isDisabled = false;
        }
        this.formConfig1.rules = {};
        this.config.table1.formLabel.prompt = false;
        if (this.$route.query.id) {
          this.getDetail(this.$route.query.id);
        } else {
          this.getDetail(row.row.id);
        }
        // this.$nextTick(() => {
        //   this.$refs.formComponent2.form = this.FilledBy;
        //   this.$set(this.$refs.formComponent.form, "effectRange", []);
        //   this.$set(this.$refs.formComponent.form, "geo", []);
        // });

        this.getSelect();
        this.Hdepartment();
        this.getOrgTree();
        this.getUnitTree();
      } else if (item === "终止") {
        this.dialogConfig.isShow = true;
        this.dialogConfig.type = "jc";
        this.dialogConfig.title = "响应命令单终止申请";
        this.dialogConfig.btnList = [
          {
            name: "提交",
            type: "primary",
            id: "save",
            size: "mini"
          },
          {
            name: "取消",
            id: "cancel",
            size: "mini"
          }
        ];
        this.titleConfig = [
          {
            title: "基本信息",
            name: "1",
            slot: "slot1"
          },
          {
            title: "措施要求",
            name: "2",
            slot: "slot2"
          },
          {
            title: "响应信息",
            name: "3",
            slot: "slot3"
          },
          {
            title: "填报信息",
            name: "4",
            slot: "slot4"
          }
        ];
        const formData = [
          {
            type: "input",
            label: "响应命令单",
            prop: "responseName",
            isDisabled: true,
            class: "sjgy",
            lableWidth: "120px"
          },
          {
            type: "select",
            label: "响应研判单",
            prop: "judgeName",
            isDisabled: true,
            // multiple: true,
            name: "judgeName",
            class: "sjgy",
            lableWidth: "120px",
            option: []
          },
          {
            type: "select",
            label: "事件类别",
            dic: "dic_sjlb",
            name: "eventName",
            prop: "eventCode",
            class: "half",
            lableWidth: "120px",
            option: [],
            isDisabled: true
          },
          {
            type: "select",
            label: "响应级别",
            dic: "dic_xyjb",
            prop: "responseLvCode",
            name: "responseLvName",
            class: "half",
            lableWidth: "120px",
            option: [],
            isDisabled: true
          },
          {
            type: "input",
            label: "影响范围",
            prop: "effectRange",
            class: "half",
            lableWidth: "120px",
            isDisabled: true
          },
          {
            // type: "dataPicker",
            type: "input",
            label: "影响时间",
            prop: "effectTime",
            isDisabled: true,
            class: "half",
            dateType: "effectTime",
            lableWidth: "120px"
          },
          {
            type: "dataPicker",
            label: "终止时间",
            prop: "terminateTime",
            class: "half",
            lableWidth: "120px",
            dateType: "datetime",
            isDisabled: false

          },
          {
            label: "终止说明",
            type: "input",
            prop: "terminateExplain",
            class: "sjgy",
            lableWidth: "120px",
            isDisabled: false
          },
          {
            label: "事件概要",
            type: "textarea",
            prop: "incidentOutline",
            class: "sjgy",
            lableWidth: "120px",
            isDisabled: true
          }
        ];
        const formData1 = [
          {
            label: "主送单位",
            dic: "unit",
            type: "select",
            prop: "mainUnitId",
            name: "mainUnitName",
            class: "sjgy",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "响应部门",
            dic: "dept",
            type: "select",
            prop: "responseDeptId",
            name: "responseDeptName",
            class: "sjgy",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "联系人",
            type: "select",
            prop: "linkmanId",
            filterable: true,
            name: "linkman",
            class: "sjgy",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "抄报",
            dic: "dic_cb",
            type: "select",
            prop: "outTheNewspaper",
            name: "newspaperId",
            class: "half",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "抄送",
            dic: "dic_cs",
            type: "select",
            prop: "sendDuplicate",
            name: "sendDuplicateId",
            class: "half",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          }
        ];
        this.$set(this.formConfig, "formData", formData);
        this.$set(this.formConfig1, "formData", formData1);
        this.formConfig3.formData[0].isDisabled = true;
        this.formConfig.rules = {
          terminateTime: [
            { required: true, message: "请选择解除时间", trigger: "blur" }
          ],
          terminateExplain: [
            { required: true, message: "请输入解除说明", trigger: "blur" }
          ]
        };
        this.formConfig1.rules = {};
        if (this.$route.query.id) {
          this.getDetail(this.$route.query.id);
        } else {
          this.getDetail(row.row.id);
        }
        this.getOrgTree();
        this.getSelect();
        this.Hdepartment();

      } else if (item === "删除") {
        this.delete(row);
      } else if (item === "预览") {
        this.dialogConfig1.isShow = true;
        this.id = row.row.id;
      } else if (item === "查看指挥部") {
        this.$router.push({
          name: "headquarters",
          query: {
            id: row.row.id
          }
        });
      }
    },
    // 获取下拉框数据
    getInputVal() {
      this.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then((res) => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: item.dicCode
              };
            });
            item.options = option;
          });
        }
      }
      );
    },
    // 获取详情下拉数据
    getSelect() {
      this.formConfig.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then((res) => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: item.dicCode
              };
            });
            item.option = option;
          });
        }
      });
      this.formConfig1.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then((res) => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: item.dicCode
              };
            });
            item.option = option;
          });
        }
        if (item.label === "联系人") {
          listAccountByOrganization().then((res) => {
            const option = res.map((item) => {
              const phone = item.phone === "" ? "" : `：(${item.phone})`;
              return {
                label: `${item.orgName}${item.realName}${phone}`,
                value: item.id
              };
            });
            item.option = option;
          });
        }
      });
    },
    // 获取新增里面的部门字典值
    async Hdepartment() {
      sameLeveltree({ accountId: JSON.parse(sessionStorage.getItem("account")).id }).then(res => {
        this.zrbmOption = res;
      });
    },
    // 重置
    reset() {
      this.form = this.$options.data().form;
      this.$refs.yjxdlb.paginationAtrrsInner["current-page"] = 1;
      this.getList();
    },
    // 筛选
    query() {
      let responseState = "";
      if (this.$route.query.responseState) {
        responseState = this.$route.query.responseState;
      } else {
        responseState = this.form.responseState;
      }
      let type = "";
      if (this.$route.query.responseState === "1") {
        type = "0";
      }
      const parmas = {
        pageNum: this.config.table.paginationAtrrs["current-page"],
        pageSize: this.config.table.paginationAtrrs["page-size"],
        responseName: this.form.responseName,
        eventCode: this.form.eventCode,
        responseLvCode: this.form.responseLvCode,
        effectRange: this.form.effectRange,
        effectStartTime: this.form.yxsj ? this.form.yxsj[0] : "",
        effectEndTime: this.form.yxsj ? this.form.yxsj[1] : "",
        type: type,
        // infoSource: this.form.infoSource,
        // approvalTime: this.form.approvalTime,
        responseState: responseState,
        // terminateTime: this.form.terminateTime,
        flowKey: "emergency_response_001",
        approvalDeptId: this.orgId,
        terminateStartTime: this.form.terminateTime ? this.form.terminateTime[0] : "", // 开始时间,
        terminateEndTime: this.form.terminateTime ? this.form.terminateTime[1] : "",
        approvalStartTime: this.form.approvalTime ? this.form.approvalTime[0] : "",
        approvalEndTime: this.form.approvalTime ? this.form.approvalTime[1] : ""
      };
      this.getList(parmas);
    },
    // 分页
    handleSizeChange(val) {
      let type = "";
      if (this.$route.query.responseState === "1") {
        type = "0";
      }
      const parmas = {
        pageNum: val["current-page"],
        pageSize: val["page-size"],
        responseName: this.form.responseName,
        eventCode: this.form.eventCode,
        responseLvCode: this.form.responseLvCode,
        effectRange: this.form.effectRange,
        effectStartTime: this.form.yxsj ? this.form.yxsj[0] : "",
        effectEndTime: this.form.yxsj ? this.form.yxsj[1] : "",
        type: type,
        // infoSource: this.form.infoSource,
        // approvalTime: this.form.approvalTime,
        responseState: this.form.responseState,
        // terminateTime: this.form.terminateTime,
        flowKey: "emergency_response_001",
        approvalDeptId: this.orgId,
        terminateStartTime: this.form.terminateTime ? this.form.terminateTime[0] : "", // 开始时间,
        terminateEndTime: this.form.terminateTime ? this.form.terminateTime[1] : "",
        approvalStartTime: this.form.approvalTime ? this.form.approvalTime[0] : "",
        approvalEndTime: this.form.approvalTime ? this.form.approvalTime[1] : ""
      };
      // this.list();
      this.getList(parmas);
    },
    // 影响时间限制
    pickerChange(val, item, num) {
      this.$nextTick(() => {
        if (
          this.$refs.formComponent.form.effectStartTime &&
          this.$refs.formComponent.form.effectEndTime
        ) {
          const start = +new Date(
            this.$refs.formComponent.form.effectStartTime
          );
          const end = +new Date(this.$refs.formComponent.form.effectEndTime);
          if (num === 1) {
            if (start > end) {
              this.$message({
                message: "开始时间不能大于结束时间",
                type: "error"
              });
              this.$set(this.$refs.formComponent.form, "effectStartTime", "");
            }
          } else {
            if (end < start) {
              this.$message({
                message: "结束时间不能小于开始时间",
                type: "error"
              });
              this.$set(this.$refs.formComponent.form, "effectEndTime", "");
            }
          }
        }
      });
    },
    // 平铺树结构
    flatTreeArr(arr) {
      return arr.reduce((acc, cur) => {
        if (Array.isArray(cur.children)) {
          const copyCur = { ...cur };
          delete copyCur.children;
          return acc.concat(copyCur, this.flatTreeArr(cur.children));
        } else {
          return acc.concat(cur);
        }
      }, []);
    }
  }
};
</script>

<style lang="less" scoped>
@import "../../../assets/style/common.less";
@import "../../../assets/style/ComponentStyle.less";
@import "../../../assets/style/pop-upNotification.less";

:deep(.el-breadcrumb__inner.is-link) {
  font-weight: 100;
  color: #fff;
}

.EmergencyList :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
  color: #3270ff;
}

.box {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 15px;
  background-color: #fff;
  border-radius: 4px;
  padding: 10px;
  box-sizing: border-box;
}

:deep(.el-select__tags-text) {
  padding: 0 10px;
  background-color: #b9cefa;
  color: #000;
}

:deep(.el-tag.el-tag--info) {
  background-color: rgba(185, 206, 250) !important;
  color: #000 !important;
  border-radius: 0px !important;
  height: 25px;
  font-size: 16px;
}

:deep(.el-tag__close) {
  background-color: rgba(185, 206, 250) !important;
  color: #000 !important;
  border-radius: 0px !important;
  height: 20px;
  font-size: 16px;
}

:deep(.el-cascader--small) {
  width: 100% !important;
  color: #000;
}

:deep(.el-select .el-tag__close.el-icon-close) {
  background: none;
  font-size: 16px;
}

.EmergencyList {
  height: 97% !important;
}
</style>
